<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>

    </style>
</head>
<body>
    <div id="root">
        <ul>
            <h2>上单三姐妹</h2>
            <button @click = "add">添加一个老刘</button>
            <li v-for="(p,index) in persons" :key="index">{{p.name}}-{{p.age}}</li>

        </ul>
        <el-button type="primary">主要按钮</el-button>
    </div>

    <script>
        new Vue({
            el:'#root',
            data:{
                persons:[
                    {id:'001',name:'刀妹',age:18},
                    {id:'002',name:'青钢影',age:19},
                    {id:'003',name:'剑姬',age:20},

                ]

            },
            methods: {
                add(){
                    const p = {id:'004',name:'老刘',age:'40'}
                    this.persons.unshift(p)
                }
            },

        })
    </script>
</body>
</html>